package com.hitqz.robot.biz.flow.component.common;

import cn.hutool.json.JSONObject;
import com.hitqz.robot.biz.flow.domain.dto.TestContextDto;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.flow.LiteflowResponse;
import lombok.extern.slf4j.Slf4j;

/**
 *
 * @author xupkun
 * @date 2024/1/27
 */
@LiteflowComponent(value = "invokeSubProcessComponent",name = "[通用组件]开启隐式子流程")
@Slf4j
public class InvokeSubProcessComponent extends NodeComponent {



    @Override
    public void process() throws Exception {
        Integer id =(Integer) this.getCmpData(JSONObject.class).get("id");
        TestContextDto contextDto = this.getRequestData();
        contextDto.getIds().add(id);
        Thread.sleep(1000+id*100);
        log.info("contextDto:{}",contextDto);
        LiteflowResponse response = this.invoke2Resp("test"+id, id);
        log.info("success:" + response.isSuccess());
    }



}
